home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Disk / moni / FileX-src.lha / FileX-src / start.c < prev    next >
Encoding:
C/C++ Source or Header  |  2004-01-07  |  2.8 KB  |  118 lines

  1. #include <intuition/intuitionbase.h>
  2. #include <workbench/workbench.h>
  3. #include <exec/execbase.h>
  4. #include <dos/dosextens.h>
  5.  
  6. #include <clib/intuition_protos.h>
  7. #include <clib/exec_protos.h>
  8. #include <clib/dos_protos.h>
  9.  
  10. #include <pragmas/intuition_pragmas.h>
  11. #include <pragmas/exec_pragmas.h>
  12. #include <pragmas/dos_pragmas.h>
  13.  
  14. #include "filex.h"
  15.  
  16.     /* exec.library base pointer. */
  17.  
  18. extern struct ExecBase    *SysBase;
  19.  
  20.     /* The approriate machine type check. */
  21.  
  22. #ifdef MACHINE020
  23. #define MACHINE_OKAY (SysBase -> AttnFlags & AFF_68020)
  24. #else
  25. #define MACHINE_OKAY (1)
  26. #endif
  27.  
  28. extern LONG main(void);
  29.  
  30. /* 
  31.  * LONG __saveds Start(void)
  32.  *
  33.  * Prüft Prozessor und Kickstartversion. Entweder wird main() aufgerufen
  34.  * oder eine Fehlermeldung ausgegeben.
  35.  */
  36.  
  37. LONG __saveds Start(void)
  38. {
  39.     static const unsigned char versionstring[] =
  40.         "\0$VER:FileX "VSTRING" ("DATE") © 1993-2004 by Klaas Hermanns and Pavel Fedin.";
  41.         /* Get SysBase. */
  42.  
  43.     SysBase = *(struct ExecBase **)4;
  44.  
  45.         /* Is the minimum required processor type and Kickstart 2.04 (or higher)
  46.          * available?
  47.          */
  48.  
  49.     if(MACHINE_OKAY && (SysBase -> LibNode . lib_Version > 37 || (SysBase -> LibNode . lib_Version == 37 && SysBase -> SoftVer >= 175)))
  50.         return(main());
  51.     else
  52.     {
  53.         register struct Process *ThisProcess = (struct Process *)SysBase -> ThisTask;
  54.  
  55.             /* Is a Shell window available? */
  56.  
  57.         if(ThisProcess -> pr_CLI)
  58.         {
  59.             register struct DosLibrary *DOSBase;
  60.  
  61.                 /* Show the message. */
  62.  
  63.             if(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",0))
  64.             {
  65.                 if(MACHINE_OKAY)
  66.                     Write(ThisProcess -> pr_COS,"Kickstart 2.04 or higher required.\n",36);
  67.                 else
  68.                     Write(ThisProcess -> pr_COS,"MC68020 or higher required.\n",29);
  69.  
  70.                 CloseLibrary((struct Library *)DOSBase);
  71.             }
  72.  
  73.             return(RETURN_FAIL);
  74.         }
  75.         else
  76.         {
  77.             register struct IntuitionBase    *IntuitionBase;
  78.             register struct WBStartup    *WBenchMsg;
  79.  
  80.                 /* Wait for startup message. */
  81.  
  82.             WaitPort(&ThisProcess -> pr_MsgPort);
  83.  
  84.                 /* Get the message. */
  85.  
  86.             WBenchMsg = (struct WBStartup *)GetMsg(&ThisProcess -> pr_MsgPort);
  87.  
  88.                 /* Show the message. */
  89.  
  90.             if(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0))
  91.             {
  92.                 STATIC struct IntuiText SorryText = {0,1,JAM1,6,3,0,"Continue",NULL};
  93.  
  94.                 if(MACHINE_OKAY)
  95.                 {
  96.                     STATIC struct IntuiText BodyText = {0,1,JAM1,5,3,0,(STRPTR)"Kickstart 2.04 or higher required.",NULL};
  97.  
  98.                     AutoRequest(NULL,&BodyText,NULL,&SorryText,NULL,NULL,309,46);
  99.                 }
  100.                 else
  101.                 {
  102.                     STATIC struct IntuiText BodyText = {0,1,JAM1,5,3,0,(UBYTE *)"MC68020 or higher required.",NULL};
  103.  
  104.                     AutoRequest(NULL,&BodyText,NULL,&SorryText,NULL,NULL,253,46);
  105.                 }
  106.  
  107.                 CloseLibrary((struct Library *)IntuitionBase);
  108.             }
  109.  
  110.                 /* Return the startup message and exit. */
  111.  
  112.             Forbid();
  113.  
  114.             ReplyMsg((struct Message *)WBenchMsg);
  115.         }
  116.     }
  117. }
  118.